<?php
/**
 * Created by PhpStorm.
 * User: sunlight
 * Date: 2018/11/19
 * Time: 16:26
 */

namespace app\common\model;

use think\Model;

class BaseModel extends Model
{

    protected $autoWriteTimestamp=true;

    /**
     * 新增
     * @param $data
     * @return mixed
     * @throws \Exception
     */
    public function add($data){
        if (!is_array($data)){
            exception('传递数据不合法');
        }
        $this->allowField(true)->save($data);

        return $this->id;
    }

}